<!DOCTYPE html>
<html>
<head lang="zh-cn">
    <link href="$!{__beat.server.contextPath}/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="$!{__beat.server.contextPath}/bootstrap/datepicker/datepicker3.css" rel="stylesheet">
    <link rel="stylesheet" href="$!{__beat.server.contextPath}/bootstrap/css/App.css" type="text/css" />
    <link rel="stylesheet" href="$!{__beat.server.contextPath}/bootstrap/css/font-awesome.min.css" type="text/css" />
    
    <link rel="stylesheet" type="text/css" href="$!{__beat.server.contextPath}/css/wnl.css">
    <meta charset="UTF-8">
    
    <title>万年历看板--淡旺季城市数据</title>
</head>
<body>

<div class="container-fluid">

    <div class="row" align="center" style="margin-bottom:8px; margin-top:5px;">
                <form class="form-inline" action="$!{__beat.server.contextPath}/calendar/season_city" method="post">
                        <div class="form-group" style="width:180px">
                            <label for="businessName" style="padding-left:15px;">业务线：</label>
                            <select id="businessName" name="businessName" class="form-control input-sm" style="align:center; width:100px; ">
                               #foreach($buss in $businessList)
                                <option value="$buss" #if("$buss" == $!businessName) selected #end>$business_CN_Map.get("$buss")</option>
                                #end  
                            </select>
                        </div>  
                        <div class="form-group">                       
                               <input type="submit" value="查询" class="btn btn-primary btn-xs">
                        </div>
                </form>
    </div>


    <div class="datacontent"  >
        <div class="dataTit">
                <i class="mark"></i><span>指标选择</span>
        </div>

        <div class="dataShow">            
            <div>
                <form class="form-inline">  

                   <div class="form-group" style="width:160px;margin-left:10px">
                                <label for="city_option">城市：</label>
                                <select id="city_option" class="form-control input-sm" style="align:center; width:100px; ">
                                <option value="all">全国</option>
                                <option value="直销城市">直销城市</option>
                                <option value="渠道城市">渠道城市</option>
                                #foreach($!{p} in ${CityList})
                                        <option value="$!{p}">$!{p}</option>
                                #end  
                                </select>
                    </div> 
                    
                     <div class="form-group" style="width:160px;margin-left:10px">
                                <label for="cate_option">类别：</label>
                                <select id="cate_option" class="form-control input-sm" style="align:center; width:100px; ">
                                     #foreach($!{p} in ${CateList})
                                        <option value="$!{p}">$!{p}</option>
                                    #end
                                </select>                     
                     </div>
                     
                     <div class="form-group" style="width:160px;margin-left:10px">
                                <label for="index_Type">指标：</label>
                                <select id="index_Type" class="form-control input-sm" style="align:center; width:100px; ">
                                    <option value="uv">UV</option>
                                    <option value="pv">PV</option>
                                    <option value="vppv">VPPV</option>
                                    <option value="list_uv">list-uv</option>
                                    <option value="list_uv">list-pv</option>
                                    <option value="list_uv">lide-uv</option>
                                    <option value="list_uv">lide-pv</option>
                                </select>                     
                     </div>
                     
                     <button id="refresh_cSeason_city_btn" type="button" class="btn btn-default form-control input-sm">刷新</button>
            </div>   
        </div>
    </div>

    <div class="datacontent"  >
        <div class="dataTit">
                <i class="mark"></i><span>$!{businessName_CN}总体淡旺季城市数据</span>
        </div>

        <div class="dataShow">            
            <div id='SeasonCityOption_all' dateGrp='week_begin'>
                <form class="form-inline">

                <label>注：气泡后面为前几年均值</label>                 
                    <div class="btn-group btn-group-sm btn-tab" role="group" aria-label="Basic example"  style="float: right">
                        <button type="button" class="btn btn-default btnSeasonCity_all" dateGrp='stat_date'>日</button>
                        <button type="button" class="btn btn-default active btnSeasonCity_all" dateGrp='week_begin'>周</button>
                        <button type="button" class="btn btn-default btnSeasonCity_all" dateGrp='month_num'>月</button>
                    </div>

                    <div>&nbsp;&nbsp;&nbsp;</div> 
                </form> 
            </div>   
            <div id="seasonCity_EC_all" style="height:380px"></div>
        </div>
    </div> <!--end of datacontent -->


     <div class="datacontent"  >
        <div class="dataTit">
                <i class="mark"></i><span>$!{businessName_CN}PC端淡旺季城市数据</span>
        </div>

        <div class="dataShow">            
            <div id='SeasonCityOption_pc' dateGrp='week_begin'>
                <form class="form-inline">   

                    <label>注：气泡后面为前几年均值</label> 
                    <div class="btn-group btn-group-sm btn-tab" role="group" aria-label="Basic example"  style="float: right">
                        <button type="button" class="btn btn-default btnSeasonCity_pc" dateGrp='stat_date'>日</button>
                        <button type="button" class="btn btn-default active btnSeasonCity_pc" dateGrp='week_begin'>周</button>
                        <button type="button" class="btn btn-default btnSeasonCity_pc" dateGrp='month_num'>月</button>
                    </div>

                    <div>&nbsp;&nbsp;&nbsp;</div>
                </form> 
            </div>   
            <div id="seasonCity_EC_pc" style="height:380px"></div>
        </div>
    </div> <!--end of datacontent -->

    <div class="datacontent"  >
        <div class="dataTit">
                <i class="mark"></i><span>$!{businessName_CN}M端淡旺季城市数据</span>
        </div>

        <div class="dataShow">            
            <div id='SeasonCityOption_m' dateGrp='week_begin'>
                <form class="form-inline">            
                       
                    <label>注：气泡后面为前几年均值</label> 
                    <div class="btn-group btn-group-sm btn-tab" role="group" aria-label="Basic example"  style="float: right">
                        <button type="button" class="btn btn-default btnSeasonCity_m" dateGrp='stat_date'>日</button>
                        <button type="button" class="btn btn-default active btnSeasonCity_m" dateGrp='week_begin'>周</button>
                        <button type="button" class="btn btn-default btnSeasonCity_m" dateGrp='month_num'>月</button>
                    </div>

                    <div>&nbsp;&nbsp;&nbsp;</div>
                </form> 
            </div>   
            <div id="seasonCity_EC_m" style="height:380px"></div>
        </div>
    </div> <!--end of datacontent -->
    

    <div class="datacontent"  >
        <div class="dataTit">
                <i class="mark"></i><span>$!{businessName_CN}APP端淡旺季城市数据</span>
        </div>

        <div class="dataShow">            
            <div id='SeasonCityOption_app' dateGrp='week_begin'>
                <form class="form-inline">                 

                    <label>注：气泡后面为前几年均值</label> 
                    <div class="btn-group btn-group-sm btn-tab" role="group" aria-label="Basic example"  style="float: right">
                        <button type="button" class="btn btn-default btnSeasonCity_app" dateGrp='stat_date'>日</button>
                        <button type="button" class="btn btn-default active btnSeasonCity_app" dateGrp='week_begin'>周</button>
                        <button type="button" class="btn btn-default btnSeasonCity_app" dateGrp='month_num'>月</button>
                    </div>
                        
                    <div>&nbsp;&nbsp;&nbsp;</div> 
                </form> 
            </div>   
            <div id="seasonCity_EC_app" style="height:380px"></div>
        </div>
    </div> <!--end of datacontent -->


</div>
</body>
<script src="$!{__beat.server.contextPath}/bootstrap/jquery.js"></script>

<link rel="stylesheet" href="$!{__beat.server.contextPath}/bootstrap/libs/jquery-ui/jquery-ui-1.9.2.custom.css" type="text/css" /> 
<link type="text/css" href="$!{__beat.server.contextPath}/bootstrap/libs/jquery-ui/jquery.multiselect.css" rel="stylesheet" />
<script src="$!{__beat.server.contextPath}/bootstrap/libs/jquery-ui/jquery-ui-1.9.2.custom.min.js"></script>
<script type="text/javascript" src="$!{__beat.server.contextPath}/bootstrap/libs/jquery-ui/jquery.multiselect.js"></script>


<script src="$!{__beat.server.contextPath}/bootstrap/js/libs/bootstrap.js"></script>
<script src="$!{__beat.server.contextPath}/bootstrap/datepicker/bootstrap-datepicker.js"></script>
<script src="$!{__beat.server.contextPath}/bootstrap/datepicker/nongLiDate.js"></script>
<script src="$!{__beat.server.contextPath}/bootstrap/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
<script src="$!{__beat.server.contextPath}/echarts2/source/echarts.js"></script>
<!-- <script src="$!{__beat.server.contextPath}/js/wnl.js"></script> -->
<script src="$!{__beat.server.contextPath}/bootstrap/js/App.js"></script>
<script type="text/javascript">
    var businessName = "$!{businessName}";

    var dayMap={1:"周一",2:"周二",3:"周三",4:"周四",5:"周五",6:"周六",0:"周日"};
    var datepicker_op={
        format: "yyyy-mm-dd",
        clearBtn: false,
        language: "zh-CN",
        autoclose: true,
        todayHighlight: true,
        minViewMode:0,
        orientation: "top left"
    };

    function getDate(yyyymmdd){
        if(yyyymmdd.length==10){        //yyyy-MM-dd
            return Date.parse(yyyymmdd.substr(0,4)+'/'+yyyymmdd.substr(5,2)+'/'+yyyymmdd.substr(8,2));
        }else if(yyyymmdd.length==8){
            return Date.parse(yyyymmdd.substr(0,4)+'/'+yyyymmdd.substr(4,2)+'/'+yyyymmdd.substr(6,2));
        }else if(yyyymmdd.length==6){
            return Date.parse(yyyymmdd.substr(0,4)+'/'+yyyymmdd.substr(4,2));
        }
    }

    //获取星期几 dayDate 的格式为 yyyy-MM-dd
    function getWeekDay(dayDate){
        var jsDate = new Date(Date.parse(dayDate.replace(/\-/g,'/')));
        var weekNumber = jsDate.getDay();
        return dayMap[weekNumber];
    }

    function setDatePicker(ec,dateGrp,input){
        if('week_begin'==dateGrp){
        }else if('month_num'==dateGrp){
            datepicker_op.minViewMode=1;
            datepicker_op.format='yyyy-mm';
        }else{
            datepicker_op.minViewMode=0;
            datepicker_op.format='yyyy-mm-dd';
        }
        input.datepicker('remove');
        input.datepicker(datepicker_op);
        //获取显示的日期数组
        var days_show=ec.getShowDays();
        var days_all=ec.getAllDays();
        //设置时间可选范围
        input.datepicker('setStartDate',new Date(getDate(days_all[0])));
        input.datepicker('setEndDate',new Date(getDate(days_all[days_all.length-days_show.length])));
    }

    function changeDateGrp(item){
        var dateGrpVal = $(item).attr('dateGrp');
        var curDiv = $(item).closest('div[dateGrp]');
        $(curDiv).attr('dateGrp',dateGrpVal);
    }

    function changeIndex(item){
        var indexVal = $(item).val();
        var curDiv = $(item).closest('div[dateGrp]');
        $(curDiv).attr('indexType',indexVal);
    }

    $('.btn-tab button').click(function(e){
        $(this).addClass('active');
        $(this).siblings('button').each(function(){
            $(this).removeClass('active');
        });
    });

    
    // 路径配置
    require.config({paths: {echarts: "$!{__beat.server.contextPath}/echarts2/dist",dashboard: "$!{__beat.server.contextPath}/js/calendar"}});
    
    var charts = [];

    //总体淡旺季数据图
    require(['dashboard/season_city_all'],function(totalEC){
        charts.push(totalEC);
        totalEC.show(businessName,2);
    });   

    //PC淡旺季数据图
    require(['dashboard/season_city_pc'],function(totalEC){
        charts.push(totalEC);
        totalEC.show(businessName,2);
    });   

    //M淡旺季数据图
    require(['dashboard/season_city_m'],function(totalEC){
        charts.push(totalEC);
        totalEC.show(businessName,2);
    });   
    
    //APP淡旺季数据图
    require(['dashboard/season_city_app'],function(totalEC){
        charts.push(totalEC);
        totalEC.show(businessName,2);
    });   
 
   

    //格式化输出数字
    function format_number(n){
        var b=parseInt(n).toString(); 
        var len=b.length; 
        if(len<=3){return b;} 
        var r=len%3; 
        return r>0?b.slice(0,r)+","+b.slice(r,len).match(/\d{3}/g).join(","):b.slice(r,len).match(/\d{3}/g).join(","); 
    };


    $(window).resize(function(){
        $.each(charts,function(i,n){
            n.resize();
        });
    });

</script>
</html>